/**
 * @ClassName PrototypeTest
 * @Description TODO
 * @Author 高达磊
 * @Date 2022/1/13-12:49
 * @Version 1.0
 */
public class PrototypeTest {
    public static void main(String[] args) throws Exception {
        // 基本原型模式
        Car prototypeCar = new Car("奥迪", "白色");
        Car  cloneCar = prototypeCar.clone();
        cloneCar.setColor("紫色");
        System.out.println(prototypeCar);
        System.out.println(cloneCar);

        //结合工厂模式和单例模式
        IPrototypeService prototypeService = new PrototypeServiceImpl();
        System.out.println(prototypeService.cloneCar("黑色"));
    }
}

